// SKU模块的接口管理
import request from '@/utils/request'
import type { SkuResponseData, SkuInfoData } from './type'
enum API {
  // 获取商品SKU接口
  SKU_URL = '/admin/product/list',
  // 上架
  SALE_URL = '/admin/product/onSale',
  // 下架
  CANCEL_SALE_URL = '/admin/product/cancelSale',
  // 获取商品详情
  SKU_INFO_URL = '/admin/product/getSkuInfo',
  // 删除sku
  DEL_SKU_URL = '/admin/product/deleteSku',
}

export const reqSkuList = (page: number, limit: number) =>
  request.get<any, SkuResponseData>(`${API.SKU_URL}/${page}/${limit}`)

export const reqOnSale = (skuId: number) =>
  request.get<any, any>(`${API.SALE_URL}/${skuId}`)

export const reqCancelSale = (skuId: number) =>
  request.get<any, any>(`${API.CANCEL_SALE_URL}/${skuId}`)

export const reqSkuInfo = (skuId: number) =>
  request.get<any, SkuInfoData>(`${API.SKU_INFO_URL}/${skuId}`)

export const reqRemoveSku = (skuId: number) =>
  request.get<any, any>(`${API.DEL_SKU_URL}/${skuId}`)
